package com.xiaoxi.common.constant.enumeration.statuscode.system;

import com.xiaoxi.common.constant.enumeration.statuscode.ParentEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * @author xiaoxi
 * @version 1.0
 * @date 2022/5/17 11:20
 */
public enum TokenSystemEnums implements ParentEnum {

    HEADER_AUTHORIZATION_NOT_CARRY("B960","请求头未携带Authorization"),
    HEADER_AUTHORIZATION_FAIL("B961", "token前缀错误"),
    TOKEN_INVALID("B962", "token已失效"),
    TOKEN_OVERDUE("B963","token已过期");

    private final String code;
    private final String message;

    TokenSystemEnums(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    @Override
    public Map<String, String> format() {
        Map<String, String> enumData = new HashMap<>();
        enumData.put("code", this.code);
        enumData.put("message", this.message);
        return enumData;
    }
}
